LIBNAME = client
INCLUDE = `pwd`/include/
MAINPATH = src/main.c
SRC_PATH = `pwd`/src/
INST_PATH = `pwd`/install
LIB_PATH = ${INST_PATH}/libs/
INC_PATH = ${INST_PATH}/include/
SQL_PATH = `pwd`/../sqlite/include/

CC = gcc
AR = ar

all:static_lib           #总目标，先执行依赖
	@make install
	@make clean

#生成静态库
static_lib:  
	${CC} -c -I ${SQL_PATH} -I ${INCLUDE} ${SRC_PATH}*.c  
	${AR} -rcs lib${LIBNAME}.a *.o 

install:
	mkdir -p ${INST_PATH}/include
	mkdir -p ${INST_PATH}/bin
	mkdir -p ${INST_PATH}/libs
	cp -rf lib${LIBNAME}.* ${LIB_PATH}
	cp -rf ${INCLUDE}*.h  ${INC_PATH}

uninstall:
	rm -f ${LIB_PATH}/lib${LIBNAME}
	rm -f ${INC_PATH}/*.h

clear:
	rm -f *.o

clean: clear
	rm -f lib${LIBNAME}.*

